package jvm.t1;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Remarks: StringTable 垃圾回收机制优化
 * Class name :Demo1_24
 * Date :2023/2/10 10:15
 * Author:杨俊源
 */
public class Demo1_24 {
    public static void main(String[] args) throws IOException {
        List<String> address = new ArrayList<>();
        System.in.read();
        for (int i = 0;i < 10;i++){
            try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("F://aa.jpg"), "UTF-8"))
            ) {
                String line = null;
                //空格开始
                long start = System.nanoTime();
                while (true) {
                    line = reader.readLine();
                    if (line == null) {
                        break;
                    }
                    address.add(line.intern());
                }
                System.out.println("cost:" + (System.nanoTime() - start) / 1000000);
            }
        }
        System.in.read();

    }
}
